# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-google-go-cmp
pkgver=0.5.8
pkgrel=1
pkgdesc="Package for equality of Go values"
arch=('any')
url="https://github.com/google/go-cmp"
license=('BSD')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/google/go-cmp/archive/v$pkgver.tar.gz")
sha512sums=('294cd82607be41b34b9f1b349b2601bb2bcb2058a9f1b3e440fc1136d1e0c09b3d6c42129ed2a98ff19f6dcc097dbd4644747b27378a983636562ccfdb526e50')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/google
  cp -a "$srcdir"/go-cmp-$pkgver "$srcdir"/build/src/github.com/google/go-cmp
  cd "$srcdir"/build/src/github.com/google/go-cmp
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/google
  cp -a "$srcdir"/go-cmp-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/google/go-cmp

  install -Dm644 go-cmp-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
